import json
from ronglian_sms_sdk import SmsSDK
def sendMsg(mobile, code):
    accId = '8aaf070882ede8b30183547decf912d1'
    accToken = 'c5d71af3dda5420a8ffa80780da188e8'
    appId = '8aaf070882ede8b30183547dedd112d8'
    sdk = SmsSDK(accId, accToken, appId)
    # 发送短信的模板
    tid = '1'
    # 是一个元组类型的
    datas = (code, 5)
    # 4. 连接redis存入， 登录时需要校验所以需要保存
    resp = sdk.sendMessage(tid, mobile, datas)
    msg = json.loads(resp)
    print('smg================================', msg)
    if msg['statusCode'] == '000000' or msg['statusCode'] == '112310':
        print(resp)
        return True
    return False
